import request from './index'

// 企业列表
export const getEnterpriseList = (name, registrationNo, legalRepresentative, pageNo, pageSize) => {
  return request.get('/enterprise/list', {
    params: {
      name,
      registrationNo,
      legalRepresentative,
      pageNo,
      pageSize,
    },
  })
}

export const getEnterpriseAll = () => {
  return request.get('/enterprise/find')
}

// 新增企业
export const createEnterprise = (data) => {
  return request.post('/enterprise/create', data)
}

// 删除企业
export const deleteEnterprise = (id) => {
  return request.delete(`/enterprise/delete/${id}`)
}

// 更新企业
export const updateEnterprise = (data) => {
  return request.put(`/enterprise/update`, data)
}

export const getEnterpriseBackList = (name, pageNo, pageSize) => {
  return request.get('/enterprise/background/list', {
    params: {
      name,
      pageNo,
      pageSize,
    },
  })
}

// enterprise/background/:id删除
export const deleteEnterpriseBack = (id) => {
  return request.delete(`/enterprise/background/${id}`)
}

export const createEnterpriseBack = (data) => {
  return request.post('/enterprise/background', data)
}
export const updateEnterpriseBack = (data) => {
  return request.put(`/enterprise/background/${data.id}`, data)
}

export const getIndustryPage = (name, pageNo, pageSize) => {
  return request.get('/enterprise/industry/list', {
    params: {
      name,
      pageNo,
      pageSize,
    },
  })
}

export const createIndustry = (data) => {
  return request.post('/enterprise/industry/create', data)
}

export const updateIndustry = (data) => {
  return request.put(`/enterprise/industry/update/${data.id}`, data)
}

export const deleteIndustryApi = (id) => {
  return request.delete(`/enterprise/industry/delete/${id}`)
}
export const getIndustryAll = () => {
  return request.get('/enterprise/industry/allList')
}

export const addEnterpriseToIndustry = (data) => {
  return request.post(`/enterprise/${data.enterpriseId}/industry/${data.industryId}`)
}

export const deleteEnterpriseToIndustry = (data) => {
  return request.delete(`/enterprise/${data.enterpriseId}/industry/${data.industryId}`)
}

export const getPatentList = (name, pageNo, pageSize) => {
  return request.get('/enterprise/patent/list', {
    params: {
      name,
      pageNo,
      pageSize,
    },
  })
}

export const addPatent = (data) => {
  return request.post('/enterprise/patent/add', data)
}

export const updatePatent = (data) => {
  return request.put('/enterprise/patent/update', data)
}

export const deletePatentAPI = (id) => {
  return request.delete(`/enterprise/patent/delete/${id}`)
}

export const addTradeMark = (data) => {
  return request.post('/enterprise/trademark/add', data)
}

export const updateTradeMark = (data) => {
  return request.put('/enterprise/trademark/update', data)
}
export const deleteTradeMarkAPI = (id) => {
  return request.delete(`/enterprise/trademark/delete/${id}`)
}

export const getTrademarkList = (name, pageNo, pageSize) => {
  return request.get('/enterprise/trademark/list', {
    params: {
      name,
      pageNo,
      pageSize,
    },
  })
}

export const addExecutive = (data) => {
  return request.post('/enterprise/executive/add', data)
}
export const updateExecutive = (data) => {
  return request.put('/enterprise/executive/update', data)
}
export const deleteExecutiveAPI = (id) => {
  return request.delete(`/enterprise/executive/delete/${id}`)
}
export const getExecutiveList = (name, pageNo, pageSize) => {
  return request.get('/enterprise/executive/list', {
    params: {
      name,
      pageNo,
      pageSize,
    },
  })
}
